package com.itheima.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.pojo.Dept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeptMapper extends BaseMapper<Dept> {
    List<Dept> DeptQueryByPage(@Param("state") Integer state, @Param("username") String username);
    @Select("select ss_dept.dept_id,ss_dept.dept_name as dept_name,sdept.dept_name as parent_name," +
            "ss_dept.state as status \n" +
            "from ss_dept,ss_dept sdept\n" +
            "where ss_dept.parent_id=sdept.dept_id")
    List<Dept> DeptQueryAll();
}